<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8"/>
    <title></title>
    <meta name="renderer" content="webkit"/>
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0"/>
    <link rel="stylesheet" href="/layuiadmin/layui/css/layui.css" media="all"/>
    <link rel="stylesheet" href="/layuiadmin/style/admin.css" media="all"/>
    <style>
        .layui-form-item .layui-input-inline {
            width: 150px;
            height: 30px;
        }
        .layui-form-label {
            width: auto;
            line-height: 30px;
        }
    </style>
</head>
<body>
<div class="layui-fluid">
    <div class="layui-card">
        <form class="layui-form" id="sbumitForm">
            <input type="hidden" name="id" value="{$model.id}">
            <div class="layui-form layui-card-header layuiadmin-card-header-auto">
                <div class="layui-form-item">
                    <div class="layui-inline" style="float: right">
                        <div class="layui-btn" id="submit">
                            查询
                        </div>
                    </div>
                    <div class="layui-inline " style="float: right;">
                        <label class="layui-form-label">账号</label>
                        <div class="layui-input-inline" style="width:120px">
                            <input type="text" name="account" placeholder="请输入用户账号" autocomplete="off" class="layui-input"/>
                        </div>
                    </div>
                </div>
            </div>
        </form>
        <div class="layui-card-body layui-table-body layui-table-main">
            <table id="demo" lay-filter="demo"></table>
        </div>
    </div>
</div>

<script src="/layuiadmin/layui/layui.js"></script>
<script>
    var content_json = <?php echo $content_json; ?>;
    layui.config({
        base: "/layuiadmin/", //静态资源所在路径
    }).extend({
        index: "lib/index", //主入口模块
    }).use(["table"], function () {
        $ = layui.jquery, table = layui.table;
        table.render(table_conf());
        $("#submit").click(function () {
            table.render(table_conf());
        });
    });

    function table_conf() {
        return {
            elem: '#demo',
            id: '#demo',
            url: '/admin/question/info?' + $("#sbumitForm").serialize(),
            defaultToolbar: [
                'filter','print',{title:'提示',layEvent: 'LAYTABLE_EXCEL',icon: 'layui-icon-table'},
            ],
            page: {
                curr: 1   //默认从第一页开始搜索
            },
            method: "get",
            //where: $("#sbumitForm").serialize(),
            limit: 10,
            limits: [10, 20,30, 50, 100],
            text: {
                none: '暂无相关数据！'//默认无数据
            },
            response: {
                statusName: 'code', //数据状态的字段名称，默认：code
                statusCode: 0,//成功的状态码，默认：0
                msgName: 'msg', //状态信息的字段名称，默认：msg
                countName: 'count', //数据总数的字段名称，默认：count
                dataName: 'list', //数据列表的字段名称，默认：data
            },
            cols: [[
                {field: 'uid', width: 150, title: '用户ID', align: 'center'},
                {field: 'account', width: 150, title: '用户账号', align: 'center'},
                {field: 'amount', width: 100, title: '下注金额', align: 'center', templet: function (item) {
                        return item.amount;
                    }
                },
                {field: '', width: 100, title: '下注内容', align: 'center', templet: function (item) {
                        if (content_json[item.guess_item - 1] ) {
                            return content_json[item.guess_item - 1];
                        }

                        return '';
                    }
                },
                {field: 'create_time', width: 160, title: '下注时间', align: 'center'},
                {field: 'profit', width: 100, title: '奖金', align: 'center'},
                {field: '', title: '状态', align: 'center', templet: function (item) {
                        var status = '';
                        switch (item.status) {
                            case 1:
                                status = '等待开奖';
                                break;
                            case 2:
                                status = '未中奖';
                                break;
                            case 3:
                                status = '中奖';
                                break;
                            case 4:
                                status = '取消';
                                break;
                        }

                        return status;
                    }
                },
            ]],
            done: function (res, curr, count) {
                res.list.forEach(function (item, index) {

                });
            },
        };
    }
</script>
</body>
</html>
